import { Injectable, UnauthorizedException } from '@nestjs/common'
import { JwtService } from '@nestjs/jwt'
import { ConfigService } from '@nestjs/config'
import { CreateUserDto } from './dto/create-user.dto'
import { UpdateUserDto } from './dto/update-user.dto'
import { ResultData } from '@/utils/result'
import { LoginDto } from '@/modules/auth/dto/index'

const Users = [
	{
		id: 1,
		username: 'admin',
		// 真实项目密码不能明文传输，一般和加密算法库一起使用
		password: 'Admin123456.',
		roles: ['admin'],
	},
	{
		id: 2,
		username: '柠檬酱',
		password: 'qaqqaq',
		roles: ['user'],
	},
	{
		id: 3,
		username: 'lowcode',
		password: 'lowcode_vue',
		roles: ['user'],
	},
]

@Injectable()
export class UserService {
	private readonly users = Users

	constructor(private readonly configService: ConfigService) {}
	create(createUserDto: CreateUserDto) {
		return 'This action adds a new user'
	}

	findAll() {
		return `This action returns all user`
	}

	findOne(username: string) {
		return this.users.find((user) => user.username === username)
	}

	update(id: number, updateUserDto: UpdateUserDto) {
		return `This action updates a #${id} user`
	}

	remove(id: number) {
		return `This action removes a #${id} user`
	}
}
